<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

class WechatWeb extends Controller {

    public function __construct($ControllerName, $Action, $QueryString) {
        parent::__construct($ControllerName, $Action, $QueryString);
        global $config;
        $config->db['db'] = 'db';
        $this->loadModel('Db');
        $this->loadModel('WechatSdk');
    }

    public function home() {
        $openid = $this->getOpenId();

        if (!WechatSdk::checkOpenIdExist($openid, $this->Db)) {
            header('location:?/WechatWeb/register.php');
            exit(0);
        }

        $this->show();
    }

}
